// pages/demo/dialog/dialogBottom/dialogBottom.ts
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showModalStatus: true,

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {

  },


  showModal: function () {// 显示遮罩层
    let that = this
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "linear",
      delay: 0
    })
    // this.animation = animation
    animation.translateY(300).step()
    that.setData({
      animationData: animation.export(),
      showModalStatus: true
    })
    setTimeout(function () {
      animation.translateY(0).step()
      that.setData({
        animationData: animation.export()
      })
    }.bind(that), 200)
  },
  hideModal() {// 隐藏遮罩层
    let that = this
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "linear",
      delay: 0
    })
    // this.animation = animation
    animation.translateY(300).step()
    that.setData({
      animationData: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).step()
      that.setData({
        animationData: animation.export(),
        showModalStatus: false
      })
    }.bind(that), 200)
  },
})